<?php

use Illuminate\Http\Request;
use \Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::prefix('wechat')->namespace('Api')->group(function () {
    //首页信息
    Route::any('/', 'WeChatController@serve');
    //发送信息
    Route::get('/send', 'WeChatController@send');
    //发送信息
    Route::get('/sendAll', 'WeChatController@sendAll');

    Route::prefix('user')->group(function () {
        //获取列表
        Route::get('/', 'UserController@getList');
        //获取批量用户信息
        Route::get('/getAll', 'UserController@getAll');
        //获取用户详细信息
        Route::get('/getInfo', 'UserController@getInfo');
    });

    //菜单管理
    Route::prefix('menu')->group(function () {
        //获取菜单列表
        Route::get('/', 'MenuController@getList');
        //获取当前菜单
        Route::get('/getCurrentList', 'MenuController@getCurrentList');
        //新增菜单
        Route::get('/store', 'MenuController@store');
    });

    //客服管理
    Route::prefix('ke-fu')->group(function () {
        //获取客服列表
        Route::get('/', 'KFController@getList');
        //获取当前在线客服列表
        Route::get('/getOnlineList', 'KFController@getOnlineList');
        //新增客服
        Route::get('/store', 'KFController@store');
        //邀请微信用户成为客服
        Route::get('/invite', 'KFController@invite');
    });

    //二维码管理
    Route::prefix('qr-code')->group(function () {
        //新增永久二维码
        Route::get('/storeForeverCode', 'QRCodeController@storeForeverCode');
        //获取二维码网址
        Route::get('/getCodeUrl', 'QRCodeController@getCodeUrl');
        //获取短网址
        Route::get('/getShortUrl', 'QRCodeController@getShortUrl');
    });

});
